<?php

class Member_model extends CI_Model {
    
    function Member_model() {
        $this->load->library('api/services/Member');
    }
    
    function member_get($member_id) {
        $data = Member::memberGet($member_id);
        
        if(!empty($data)) return $data;
        else return false;
    }
    
    function member_set($firstname, $lastname, $username, $email, $password) {
        return Member::memberSet($firstname, $lastname, $username, $email, $password);
    }
    
    function member_update($member_id, $firstname, $lastname, $username, $email, $password) {
        return Member::memberUpdate($member_id, $firstname, $lastname, $username, $email, $password);
    }
    
    function member_delete($member_id) {
        return Member::memberDelete($member_id);
    }
    
    function members_list() {
        $data = Member::membersList();
        
        if(!empty($data)) return $data;
        else return false;   
    }
    
    function authenticate($username, $password) {
        $data = Member::memberAuthenticate($username, $password);
        if(!empty($data)) return array('authentification' => true, 'data' => $data);
        else return array('authentification' => false);
    }
    
    function member_admin_authenticate($username, $password) {
        return Member::memberAdminAuthenticate($username, $password);
    }    

/*    
    function memberSet($firstname, $lastname, $username, $email, $password) {
        $arguments = array('firstname'=>$firstname, 'lastname'=>$lastname, 'username'=>$username, 'email'=>$email, 'password'=>$password);
        if(parent::checkArguments($arguments))
                return false;
        
        $this->db->insert('member', $arguments);
        
        return $this->db->insert_id();
    }
*/

}

?>
